<?php include('./templete/public/head.php') ?>

<body class="bgcolor">


<!--提议详情-->
<div class="golden-idea-detail tiyi-detail">
    <div class="ideal-detail1">
        <div class="detail-text">
            <p class="p1 pfbold"><?php echo $rows['title'] ?></p>
            <p class="p2"><?php echo $rows['questiont'] ?></p>
            <p class="p3">
                <img src="<?php echo getAvatar($rows['create_user_info']['avatar']) ?>" class="head-img"/>
                <span><?php echo $rows['create_user_info']['name'] ?><?php echo date('Y-m-d', strtotime($rows['add_time'])) ?></span>
            </p>
        </div>
    </div>
    <div class="ideal-detail2">
        <ul class="comm-table-view">
            <li class="table-view-cell">
                <a>
                    <span>提议分类</span>
                    <span><?php echo $rows['propose_type_text'] ?></span>
                </a>
            </li>
            <?php if ($rows['question_files']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>问题附件</span>
                        <span><a href="<?php echo $rows['question_files'] ?>" class="search-btn">(查看附件)</a></span>
                    </a>
                </li>
            <?php } ?>
            <li class="table-view-cell">
                <a>
                    <span>解决方案</span>
                    <span><?php echo $rows['question_soluton'] ?></span>
                </a>
            </li>

            <?php if ($rows['question_soluton_files']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>问题附件</span>
                        <span><a href="<?php echo $rows['question_soluton_files'] ?>" class="search-btn">(查看附件)</a></span>
                    </a>
                </li>
            <?php } ?>
            <li class="table-view-cell">
                <a>
                    <span>提议人</span>
                    <span><?php echo $rows['create_user_info']['name'] ?></span>
                </a>
            </li>

            <li class="table-view-cell">
                <a>
                    <span>是否形成知识产权</span>
                    <span><?php echo $rows['is_copyright'] == 1 ? "是" : "否" ?></span>
                </a>
            </li>
            <?php if ($rows['is_copyright'] == 1) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>支持产权类型</span>
                        <span><?php echo $rows['copyright_type'] == 1 ? "专利" : "商业秘密" ?></span>
                    </a>
                </li>
            <?php } ?>
            <?php if ($rows['leader_content']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>部门领导意见</span>
                        <span><?php echo $rows['leader_content'] ?></span>
                    </a>
                </li>
            <?php } ?>
            <?php if ($rows['class_content']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>分管领导意见</span>
                        <span><?php echo $rows['class_content'] ?></span>
                    </a>
                </li>
            <?php } ?>
            <?php if ($rows['hr_content']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>人事部</span>
                        <span><?php echo $rows['hr_content'] ?></span>
                    </a>
                </li>
            <?php } ?>
            <?php if ($rows['solution_leader_content']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>改善部门领导意见</span>
                        <span><?php echo $rows['solution_leader_content'] ?></span>
                    </a>
                </li>
            <?php } ?>
            <?php if ($rows['solution_content']) { ?>
                <li class="table-view-cell">
                    <a>
                        <span>解决方案</span>
                        <span><?php echo $rows['solution_content'] ?></span>
                    </a>
                </li>
            <?php } ?>
        </ul>
        <?php if ($is_auth == 1) { ?>
            <div class="detail2-btn comm-btn2 comm-btn">
                <span class="color1"  onclick="location.href='/index/propose/deal?id=<?php echo $rows['id']?>'">
                    <?php echo $next_text[$rows['status']] ?></span>
                <?php if (!in_array($rows['status'],[4,5])) { ?>
                    <span class="color2" onclick="deny()">拒绝</span>
                <?php } ?>
            </div>
        <?php } ?>


        <!--时间进展-->
        <div class="ideal-detail3">
            <p class="title">时间进度</p>
            <ul class="detail3-list">
                <li class="list-item">
                    <a>
                        <div class="item-text">
                            <p class="p1 clearfix">
                            <span class="fl"><?php if ($rows['status'] == 6) {
                                    echo '结束';
                                } elseif ($rows['status'] == 0) {
                                    echo '关闭';
                                } else {
                                    echo '下一阶段';
                                } ?></span>
                            </p>
                            <?php if (($rows['status'] != 0) && ($rows['status'] != 6)) { ?>
                                <p class="p2"><?php echo $next_status ?></p>
                            <?php } ?>
                        </div>
                    </a>
                </li>
                <?php foreach ($log as $v) { ?>
                    <li class="list-item">
                        <a onclick="showmessage(this)">
                            <p style="display: none" class="message_content"><?php echo $v['content'] ?></p>
                            <p style="display: none" class="message_file_url"><?php echo $v['file_url'] ?></p>
                            <img src="<?php echo getAvatar($v['avatar']) ?>" class="head-img"/>
                            <div class="item-text">
                                <p class="p1 clearfix">
                                    <span class="fr"><?php echo $v['add_time'] ?></span>
                                </p>
                                <p class="p2"><i class="iconfont icon-wancheng"></i><?php echo $v['content'] ?></p>
                            </div>
                        </a>
                    </li>
                <?php } ?>
            </ul>
        </div>
    </div>
</body>
</html>
<script>
    function deny() {
        layer.confirm('确认不实施提议吗？', {
            btn: ['确认', '取消']
        }, function () {
            let load = layer.load();
            $.ajax({
                    url: "<?php echo url('deny')?>",
                    data: {
                        id:<?php echo $rows['id']?>
                    },
                    success: function (data) {
                        layer.close(load);
                        layer.msg(data.msg);
                        if (data.code == 1) {
                            setInterval(function () {
                                location.href = "<?php echo url('detail', ['id' => $rows['id']])?>"
                            }, 2000)
                        }
                    }
                }
            )
        }, function () {
            layer.msg('操作已取消');
        })
    }
</script>